<template>
    <!--建档资料维护模块 光标跟随扩档页面-->
    <div class="baseInfoPage">
        <div class="title" >
            <span>初审意见</span>
        </div>
        <div class="table_container">
            <el-table
                :data="cusf04List"
                highlight-current-row
                header-cell-class-name="table-header-class"
                style="width:100%">
                <el-table-column
                    width="80"
                    property="descitem"
                    label="序号"
                    align='center'>
                </el-table-column>
                <el-table-column
                    property="notedesc"
                    label="初审人员意见"
                    align='center'>
                </el-table-column>
            </el-table>
        </div>

        <div class="title mt20" >
            <span>录入意见</span>
        </div>
        <div class="table_container">
            <el-table
                :data="cusf08List"
                highlight-current-row
                header-cell-class-name="table-header-class"
                style="width:100%">
                <el-table-column
                    width="80"
                    property="descitem"
                    label="序号"
                    align='center'>
                </el-table-column>
                <el-table-column
                    property="note1"
                    label="Notel"
                    align='center'>
                    <template slot-scope="scope">
                       <div v-for="(item,index) in inputideatype" :key="index" >
                            <div v-if="scope.row.note1 == item.pncode"
                                 class="com-txt" :title="item.pedesc">
                                 {{item.pedesc}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                 <el-table-column
                    property="remark01"
                    label="类别"
                    align='center'>
                    <template slot-scope="scope">
                        <div v-for="(item,index) in inputideatype" :key="index" >
                            <div v-if="scope.row.note1 == item.pncode"
                                 class="com-txt" :title="item.pedesc">
                                 {{item.pedesc}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                 <el-table-column
                    property="notedesc"
                    label="内容"
                    align='center'>
                </el-table-column>
                 <el-table-column
                    property="userProfile"
                    label="人员"
                    align='center'>
                </el-table-column>
            </el-table>
        </div>
        <div class="title mt20" >
            <span>复核意见</span>
        </div>
        <!-- 操作按钮 -->
        <el-row> 
            <el-col :span="24" class="pb15">
                <el-button :disabled="flag =='N'"  @click="addCusf03" type="danger" plain>新增</el-button>
            </el-col>
        </el-row> 
        <div class="table_container">
            <el-table
                :data="cusf03List"
                highlight-current-row
                header-cell-class-name="table-header-class"
                style="width:100%">
                <el-table-column
                    property="descitem"
                    label="序号"
                    width="80"
                    align='center'>
                     <template slot-scope="scope">
                        <el-input clearable  v-model="scope.row.descitem" disabled type="text"/>
                    </template>
                </el-table-column>
                 <el-table-column
                    property="note1"
                    label="Notel"
                    align='center'>
                    <template slot-scope="scope">
                        <el-input  clearable v-model="scope.row.note1" disabled type="text"/>
                    </template>
                </el-table-column>
                 <el-table-column
                    property="remark01"
                    label="类别"
                    align='center'>
                    <template slot-scope="scope">
                        <el-select  :disabled="flag =='N'" v-model="scope.row.remark01"  placeholder="" >
                            <el-option
                                v-for="item in types"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column
                    property="notedesc"
                    label="内容"
                    align='center'>
                    <template slot-scope="scope">
                        <el-input :disabled="flag =='N'" :title="scope.row.notedesc" clearable v-model="scope.row.notedesc" type="text"/>
                    </template>
                </el-table-column>
                <el-table-column
                    property="remark02"
                    label="复核人员"
                    width="150"
                    align='center'>
                    <template slot-scope="scope">
                        <el-input clearable v-model="scope.row.remark02" disabled type="text"/>
                    </template>
                </el-table-column>
                <el-table-column
                    property="dateup"
                    label="复核时间"
                    width="130"
                    align='center'>
                    <template slot-scope="scope">
                        <el-input clearable v-model="scope.row.dateup" disabled type="text"/>
                    </template>
                </el-table-column>
                <el-table-column
                    label="操作"
                    width="80"
                    align='center'>
                       <template slot-scope="scope">
                            <span  class="operationIcon" @click="removeCusf03(scope.$index, scope.row)">
                                <!-- 删除操作 -->
                                <el-tooltip class="item" effect="light" content="删除" placement="top">
                                    <i class="el-icon-delete"></i>
                                </el-tooltip>
                            </span>
                        </template>
                    </el-table-column>
            </el-table>
        </div>

        <div class="title mt20" >
            <span>录入差错</span>
        </div>
        <div class="table_container">
            <el-table
                width="80"
                :data="cusf02List"
                highlight-current-row
                header-cell-class-name="table-header-class"
                style="width:100%">
                <el-table-column
                    property="descitem"
                    label="序号"
                    align='center'>
                </el-table-column>
                <el-table-column
                    property="remark01"
                    label="Notel"
                    align='center'>
                </el-table-column>
                 <el-table-column
                    property="remark01"
                    label="差错类别"
                    align='center'>
                </el-table-column>
                 <el-table-column
                    property="notedesc"
                    label="内容"
                    align='center'>
                </el-table-column>
            </el-table>
        </div>

        <div class="title mt20" >
            <span>初审差错</span>
        </div>
        <div class="table_container">
            <el-table
                width="80"
                :data="cusf07List"
                highlight-current-row
                header-cell-class-name="table-header-class"
                style="width:100%">
                <el-table-column
                    property="descitem"
                    label="序号"
                    align='center'>
                </el-table-column>
                <el-table-column
                    property="notel"
                    label="Notel"
                    align='center'>
                </el-table-column>
                 <el-table-column
                    property="remark01"
                    label="类别"
                    align='center'>
                </el-table-column>
                 <el-table-column
                    property="notedesc"
                    label="内容"
                    align='center'>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>
<script>
    import { getInputideatype } from "@/api/policyRecord/materialsMaintain/insurance";
    import constant from '@/utils/constant';
    export default {
        data(){
            return {
                value:'',
                types:[
                    {value:'',label:''},
                    {value:'1',label:'栏位漏勾'},{value:'2',label:'栏位漏填'},
                    {value:'3',label:'其它'},{value:'4',label:'缴费/领取年限漏填写'},
                    {value:'5',label:'客户ID与旧客不一致'},{value:'6',label:'漏填写与保额/保费'},
                    {value:'7',label:'送金单缴费非投保人'},{value:'8',label:'见日常事务联系单'}
                ],
                cusf04List: [],//初审意见
                cusf08List: [],//录入意见
                cusf03List: [],//复核意见
                cusf02List: [],//录入差错
                cusf07List: [],//初审差错
                insureDataForm: this.insureData,
                euaa: {},
                inputideatype:[]
            }
        },
        props:{
			flag:{
				type:String
			},
            insureData:{
                type: Object,
            }
        },
        mounted(){
            this.reloadInsureData(null);
            this.getInputideatype();
        },
        methods: {
            removeCusf03(index, row){
                this.cusf03List.splice(index,1);
            },
            addCusf03(){
                let dateup = 0;
                if(this.euaa.curTime){
                    let time = new Date(this.euaa.curTime);
                    let y = time.getFullYear();
                    let m = time.getMonth() + 1;
                    let d = time.getDate();
                    dateup = y+''+(m<10?'0'+m:m)+''+(d<10?'0'+d:d);
                }
                let cusf03 = {
                    "applnum": "","base": "03","descitem": "",
                    "notedesc": "","remark01": "1","remark02": this.euaa.as_user_1.split('/')[0],
                    "remark03": "","instprem01": 0.0,"instprem02": 0.0,"instprem03": 0.0,
                    "instprem04": 0.0,"instprem05": 0.0,"dateup": dateup,
                    "flag01": "","flag02": "","flag03": "",
                    "flag04": "","flag05": "","jobName": "","userProfile": "",
                    "datime": "","note1": ""
                };
                let maxh = 0;
                if(this.cusf03List.length > 0){
                    maxh = this.cusf03List[this.cusf03List.length-1].descitem;
                }
                cusf03.descitem = parseInt(maxh) + 1;
                this.cusf03List.push(cusf03);
                this.insureDataForm.cusf03List = this.cusf03List;
            },
            reloadInsureData(insureData){
                if(insureData != null){
                    this.insureDataForm = insureData;
                }
                this.cusf04List = this.insureDataForm.cusf04List;
                this.cusf08List = this.insureDataForm.cusf08List;
                this.cusf03List = this.insureDataForm.cusf03List;
                this.cusf02List = this.insureDataForm.cusf02List;
                this.cusf07List = this.insureDataForm.cusf07List;
                this.euaa = this.insureDataForm.euaa;
            },
            getInsureData(){
                return this.insureDataForm;
            },
            getInputideatype(){
                let para = {};
                getInputideatype(para).then(res => {
                    if(res.resultCode == constant.SUCCESS){
                        if(res.data){
                            this.inputideatype = res.data;
                        }
                    }
                }).catch(err =>{
                    console.log(err);
                })   
            }
        },
        watch:{
            /**insureDataForm:{
                handler(val, oldVal){
                    if(this.insureDataForm != undefined){
                        this.$emit('updataCursorEx', this.insureDataForm)
                    }
                },
                deep:true
            }**/
        }
    }
</script>
<style lang="less" scoped>
.baseInfoPage{
    // 操作删除图标
    .operationIcon{
        border:1px solid #e5e5e5;
        box-shadow:0 0 3px #f9f9f9;
        border-radius: 50%;
        cursor: pointer;
        color: #68a3fc;
        display: inline-block;
        width: 22px; 
        height: 22px; 
    }
}
</style>